package com.qf.day15.stream;

import java.util.Arrays;
import java.util.List;

public class StreamDemo3 {
    public static void main(String[] args) {
        //求和
        List<Integer> list = Arrays.asList(3, 1, 2, 4);
        Integer reduce = list.stream().reduce(0, (a, b) -> a + b);
        System.out.println(reduce);
    }
}
